//财务管理-发票列表-配置文件
App.util.ns('Admin.Finance.Invoice');
Admin.Finance.Invoice.Conf = {
    columns: [
        {name: '发票名称', value: 'payer_name'},
        {name: '用户昵称',width: '120px', value: function(item){
            return item.user ? item.user.nickname : '-- --';
        }},
        {name: '收款方姓名', width: '120px', value: 'income_name'},
        {name: '总费用', width: '120px', value: 'fee'},
        {name: '类型', width: '90px',value: function(item){
            switch (item.type+'') {
                case '1':
                    return '个人';
                case '2':
                    return '公司';
            }
        }},
        {name: '状态', width: '90px',value: function(item){
            switch (item.status+'') {
                case '0':
                    return '发票';
            }
        }},
        {name: '创建日期', width: '80px', value: function(item){
            return App.util.formator.date(item.created_at);
        }}
    ],
    form: [
        {type: 'hidden', name: 'id'},
        {type: 'input', name: 'payer_name', title: '发票名称', required: true,},
        {type: 'chosen', name: 'user_id', title: '昵称',required: true,
            items: App.models.get('user-all'),
            item_key: 'id',
            item_name: 'nickname',
            value_key: 'id',
            rule:{
                type: 'num',
                range: [1, 10]
            }
        },
        {type: 'input', name: 'income_name', title: '收款方姓名', required: true,},
        {type: 'img', name: 'img', title: '电子发票',rule: {
            type: 'str',
            range: [0, 255]
        }},
        {type: 'textarea', name: 'content', title: '发票信息', maxLength: 1000,
            rule: {
            type: 'str',
            range: [0, 1000]
        }},
    ]
};